package zeebe.gateway.Exclusive;

import io.vertx.core.json.JsonObject;
import io.zeebe.client.ZeebeClient;
import io.zeebe.client.api.response.ActivatedJob;
import io.zeebe.client.api.worker.JobClient;
import io.zeebe.client.api.worker.JobHandler;

public class SmallJobWorkerHandler implements JobHandler {
    ZeebeClient zeebeClient;

    public SmallJobWorkerHandler(ZeebeClient client) {
        this.zeebeClient = client;
    }

    @Override
    public void handle(JobClient client, ActivatedJob job) throws Exception {
        System.out.println("开始执行smallJobWorker");

        JsonObject value = new JsonObject(job.getVariables());
        System.out.println("执行SmallService：当前值为："+value.getInteger("data"));

        client.newCompleteCommand(job.getKey())
                .send()
                .join();
    }
}
